%by clq
function []=figure6()
figure(6)
%need to input i_best,TotalP,TotalPP,TotalR,TotalRP
%%%%%%%%%%%%%%%%%%%%%%%%p=(0.25,0.5,0.75)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%call_in_sequence=[2 2 1 3 3 3 3 3 2 2 1 2 3 3 3 3 1 1 2 1 3 1 2 3 1 1 1 2 3 1 2 3 3 1 2 1 3 3 2 2 2 1 1 2 1 1 2 1]
P=[0.25,0.5,0.75];

%------------------------calling other functions------------------------%

%proposed policy
[best_is,opt_profits]=proposed(j_all)
%proposed policy with preference
[best_is_pref,opt_profits_pref]=proposed_pref(j_all)
%round robin
[i_R,profits_R]=round_robin(j_all)
%round robin with preference
[i_RP,profits_RP]=round_robin_pref(j_all)


n=length(best_is);

%first draw the expected profit
yyaxis left;
plot(1:n,opt_profits,'-');
hold on; plot(1:n,profits_R,'--');
hold on; plot(1:n,opt_profits_pref,'.:');
hold on; plot(1:n,profits_RP,'.--');
legend('Proposed Policy','Round Robin','Prop. Policy with Pref.','Round Robin with Pref.','Location','NorthWest')

%then mark the best slot
yyaxis right;
hold on; stem(1:n,best_is,'o:');

%at last different labels
ylabel('Expected Profit');
xlabel('Sequence of patient types');
yyaxis left;
xticks([1:48])
xticklabels({'2','2','1','3','3','3','3','3','2','2','1','2','3','3','3','3','1','1','2','1','3','1','2','3','1','1','1','2','3','1','2','3','3','1','2','1','3','3','2','2','2','1','1','2','1','1','2','1'});
yticks([1 2 3 4 5 6 7 8]);
yticklabels({'1:(2,2,2)','2:(1,0,3)','3:(2,1,2)','4:(1,2,1)','5:(2,0,2)','6:(2,2,1)','7:(0,1,2)','8:(1,1,1)'})

%different lines and marks
hold on; line([30,30],[0,1800],'LineWidth',5);
hold on; line([31,31],[0,1800],'LineWidth',5);
end